// $Id: networkslotalloc.h 63 2004-10-22 14:33:20Z jonas $
#ifndef NETWORKSLOTALLOC_H
#define NETWORKSLOTALLOC_H

#include "network.h"

const int slotSize = 10000;

/**
 * @todo Write documentation
 */
class NetworkSlotAlloc : public Network {
public:
	NetworkSlotAlloc(list<Node *> *);
	//~NetworkSlotAlloc();

	void transfer();

private:
	/**
	 * @todo Documentation goes here...
	 */
	class NodeSlotWrapper {
	public:
		NodeSlotWrapper();
		NodeSlotWrapper(Node *);
		~NodeSlotWrapper();

		Node *m_node;
		int m_slotsUpCount;
		int m_slotsDownCount;

		/**
		* @todo Documentation goes here...
		*/
		// TODO: Depricated
		/*class TransferSlotWrapper {
		public:
			TransferSlotWrapper(Transfer *);

			Transfer *m_transfer;
			int m_slotCount;
		};*/

		Transfer *getNextTransfer();
		void resetTransferIterator();

		/*list<TransferSlotWrapper *> m_transfers;
		list<TransferSlotWrapper *>::iterator m_transferIterator;*/
		int m_transferIterator;
	};
	map<Node *, NodeSlotWrapper> m_nodeWrappers;

	bool transferChain(NodeSlotWrapper *, Transfer *);
};

#endif
